package com.xzjt.common.utils;

import cn.hutool.core.util.RandomUtil;

import java.util.UUID;

/**
 * @ProjectName: finance
 * @PackageName: com.xingzhi.finance.common.utils
 * @ClassName: RandomUtils
 * @User: JiaWei
 * @Date: 2021/08/26 11:44
 * @Week: 星期四
 * @Description: 随机数工具类
 */
public class RandomUtils {

    /**
     * 随机生成包含数字与字母的字符串
     *
     * @param length 生成的字符串长度
     * @return
     */
    public static String randomString(int length) {
        return RandomUtil.randomString(length);
    }

    /**
     * 随机生成数字的字符串
     *
     * @param length 生成的字符串长度
     * @return
     */
    public static String randomNumbers(int length) {
        return RandomUtil.randomNumbers(length);
    }

    /**
     * 随机生成UUID
     *
     * @return
     */
    public static String randomUUID() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }

    public static void main(String[] args) {
        System.out.println(randomNumbers(5));
    }

}
